<% content_for :css do %>
  <%= stylesheet_link_tag 'sessions_new' %>
<% end %>
<% content_for :javascript do  %>
  <script>
    function send_password_email()
    {
      if($F('session_nick_name_or_email_or_mobile') == '')
      {
          $('session_nick_name_or_email_or_mobile').focus();
          alert('请填写昵称或Email');
      }
      else
      {
        <%= remote_function :url => send_password_email_users_url,
              :method => :post,
              :with => "'&nick_name_or_password_or_mobile=' + $F('session_nick_name_or_email_or_mobile')",
              :loading => "$('send_password_email').innerHTML = '正在发送邮件....'",
              :complete => "alert(request.responseText);$('send_password_email').innerHTML='发送密码到我的邮箱'" 
         %>
      }
    }
    
    function send_password_sm()
    {
      if($F('session_nick_name_or_email_or_mobile') == '')
      {
          $('session_nick_name_or_email_or_mobile').focus();
          alert('请填写昵称或Email');
      }
      else
      {
        <%= remote_function :url => send_password_sm_users_url,
              :method => :post,
              :with => "'&nick_name_or_password_or_mobile=' + $F('session_nick_name_or_email_or_mobile')",
              :loading => "$('send_password_sm').innerHTML = '正在发送短信....'",
              :failure => "alert('发送失败,' + fetion_sm_state_name(request.responseText) + '。请采用邮箱的方式找回密码')",
              :success => "alert(fetion_sm_state_name(request.responseText))",
              :complete => "$('send_password_sm').innerHTML='发送密码到我的手机'" 
         %>
      }
    }
  </script>
<% end %>
<div class="prepend-1 span-22 last" id="main">
  <div class="span-11 mt mb" style="margin-left:130px;_margin-left:70px;">
    <div class='line'>
    <%= image_tag "sessions/login.gif", :size => '360x48', :alt => '会员登录', :title => '会员登录' %>
    </div>
    <div class='line'>
    <% if @login_failed %>
      <div class="error">
        昵称/Email和密码不匹配哦，再仔细想想。如果忘记了请
        <%= link_to_function "<b>点击发送到邮箱</b>", "send_password_email()", :title => '点击发送到邮箱', :class => :white, :id => :send_password_email %>
        <% if @user.try(:mobile?) %>
         或 <%= link_to_function "<b>点击发送到手机</b>", "send_password_sm()",:title => '点击发送到手机' , :class => :white, :id => :send_password_sm %>
        <% end %>!
      </div>
    <% end %>
    <% if params[:authorized_code_login_time_out].present? %>
      <div class="error">
        该快速登录链接已经失效，请尝试重新登录。
      </div>
    <% end %>
    </div>
    <div class='line'>
      <div class="span-10 last">
        <% form_for :session, :url => sessions_url, :method => :post do |f| %>
          <label for="session_nick_name_or_email_or_mobile">昵称 / Email / 手机号</label><br>
          <%= f.text_field :nick_name_or_email_or_mobile, :class => 'required text', :title => '请输入昵称或Email或手机号' %><br>
          <label for="session_password">密码</label><br>
          <%= f.password_field :password, :class => 'required text', :title => '请输入密码' %><br>
          <%= hidden_field_tag :http_referer, @http_referer  %>
          <%= f.check_box :remember_me, {:class => :no}, 'yes','no' %> <label for="session_remember_me">下次自动登录</label>
          <%= link_to "还不是会员？5秒就搞定！", new_user_url(:http_referer => @http_referer), :title => '只需3秒就能注册成为麦吐司会员', :class => :h1 %>
          <br><br>
          <button tabindex="1" class="button positive" type="submit"><%= image_tag "sessions/lock.png", :alt => 'Login', :title => 'Login' %> 会员登入 </button>          
          <%#*<br>&nbsp; &nbsp; <a class="px12" href="/openid.php?openid_action=login&amp;openid_url=https://www.google.com/accounts/o8/id"><u>或者，直接使用您的 <span style="color: blue;">G</span><span style="color: red;">o</span><span style="color: rgb(255, 102, 0);">o</span><span style="color: blue;">g</span><span style="color: green;">l</span><span style="color: red;">e</span> 帐号登录</u></a>%>
        <% end %>
      </div>
    </div>
  </div> 

  <%#*<div class="span-2 mt">%>
    <%#= image_tag "sessions/login_or.gif", :size => '25x150', :alt => '或', :title => '或', :style=>"margin-top: 50px;" %>
  <%#*</div>%>
  <%#*<div class="span-8 last mt">%>
    <%#*<br>%>
    <%#= image_tag "sessions/openid.gif", :size => '360x48', :alt => 'OpenID 登录', :title => 'OpenID 登录' %><br clear="all">
    <%#*<br>%>
    <%#*<div class="span-7 last">%>
      <%#*<form method="post" action="/openid.php" id="openid">%>
          <%#*<label for="openidurl">OpenID 地址</label><br>%>
          <%#*<input type="text" value="http://" id="openidurl" name="openid_url" class="text openid_login validate-url required" ><br>%>
          <%#*<button class="button positive" type="submit">%>
            <%#= image_tag "sessions/user.png", :alt => 'OpenID', :title => 'OpenID'  %> <%#= "OpenID 登入"  %>
          <%#*</button>%>
          <%#*<br class="clear">%>
          <%#*<br>%>
          <%#*<a href="/openid.php"><u>什么是 OpenID?</u></a>%>
          <%#*<input type="hidden" value="login" name="openid_action">%>
      <%#*</form>%>
    <%#*</div>%>
  <%#*</div>%>
</div>